package com.cloud.rou.im.server;

import jdk.nashorn.internal.ir.annotations.Immutable;

/**
 * <p></p>
 *
 * @author GaoShuangWen
 * @since 2019-11-15 18:59
 */
public class BlockStrategies {
    private static final BlockStrategy THREAD_SLEEP_STRATEGY = new BlockStrategies.ThreadSleepStrategy();

    private BlockStrategies() {
    }

    public static BlockStrategy threadSleepStrategy() {
        return THREAD_SLEEP_STRATEGY;
    }

    private static class ThreadSleepStrategy implements BlockStrategy {
        private ThreadSleepStrategy() {
        }

        public void block(long sleepTime) throws InterruptedException {
            Thread.sleep(sleepTime);
        }
    }
}
